package com.zmhc.product.service.impl;

import java.util.List;
import com.zmhc.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zmhc.product.mapper.DraftGoodsMapper;
import com.zmhc.product.domain.DraftGoods;
import com.zmhc.product.service.IDraftGoodsService;

/**
 * 草稿商品Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-12-11
 */
@Service
public class DraftGoodsServiceImpl implements IDraftGoodsService 
{
    @Autowired
    private DraftGoodsMapper draftGoodsMapper;

    /**
     * 查询草稿商品
     * 
     * @param id 草稿商品主键
     * @return 草稿商品
     */
    @Override
    public DraftGoods selectDraftGoodsById(Long id)
    {
        return draftGoodsMapper.selectDraftGoodsById(id);
    }

    /**
     * 查询草稿商品列表
     * 
     * @param draftGoods 草稿商品
     * @return 草稿商品
     */
    @Override
    public List<DraftGoods> selectDraftGoodsList(DraftGoods draftGoods)
    {
        return draftGoodsMapper.selectDraftGoodsList(draftGoods);
    }

    /**
     * 新增草稿商品
     * 
     * @param draftGoods 草稿商品
     * @return 结果
     */
    @Override
    public int insertDraftGoods(DraftGoods draftGoods)
    {
        draftGoods.setCreateTime(DateUtils.getNowDate());
        return draftGoodsMapper.insertDraftGoods(draftGoods);
    }

    /**
     * 修改草稿商品
     * 
     * @param draftGoods 草稿商品
     * @return 结果
     */
    @Override
    public int updateDraftGoods(DraftGoods draftGoods)
    {
        draftGoods.setUpdateTime(DateUtils.getNowDate());
        return draftGoodsMapper.updateDraftGoods(draftGoods);
    }

    /**
     * 批量删除草稿商品
     * 
     * @param ids 需要删除的草稿商品主键
     * @return 结果
     */
    @Override
    public int deleteDraftGoodsByIds(Long[] ids)
    {
        return draftGoodsMapper.deleteDraftGoodsByIds(ids);
    }

    /**
     * 删除草稿商品信息
     * 
     * @param id 草稿商品主键
     * @return 结果
     */
    @Override
    public int deleteDraftGoodsById(Long id)
    {
        return draftGoodsMapper.deleteDraftGoodsById(id);
    }
}
